import React from "react";
import { Card } from 'antd';
import Base0201 from "./components/base02-01";
import Base0202 from "./components/base02-02";
import Base0203 from "./components/base02-03";
export default class Base02 extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            fromSon01: "我现在是父值",
            fromSon02: "我现在是父值"
        }
    }
    handleClick = (v) => {
        console.log(v)
        this.setState({
            fromSon01: v
        })
    }
    getValue(val) {
        this.setState({
            fromSon02: val
        })
    }
    render() {
        const base = {
            sex: "男",
            age: "25"
        }
        return (
            <div>
                <Card title="父传子" bordered={false}>
                    <Base0201 title="只能是字符串" base={base} name="nns"></Base0201>
                </Card>




                <Card className="margin_top_sm" title="子传父 --箭头函数" bordered={false}>
                    <h3>{this.state.fromSon01}</h3>
                    <br />
                    <Base0202 handleSon={(v) => this.handleClick(v)}></Base0202>
                </Card>





                <Card className="margin_top_sm" title="子传父 --bind函数" bordered={false}>
                    <h3>{this.state.fromSon02}</h3>
                    <br />
                    <Base0203 content={this.getValue.bind(this)}></Base0203>
                </Card>




            </div>

        )
    }
}
